package edu.uoc.tdp.pac4.server;

import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import edu.uoc.tdp.pac4.beans.Course;
import edu.uoc.tdp.pac4.client.stats.StatResultData;
import edu.uoc.tdp.pac4.common.StatisticsManagerInterface;
import edu.uoc.tdp.pac4.database.StatsManager;

public class StatisticsManagerImpl extends java.rmi.server.UnicastRemoteObject
implements StatisticsManagerInterface, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	
	public StatisticsManagerImpl() throws RemoteException {
		super();
	}

	public StatisticsManagerImpl(int port) throws RemoteException {
		super(port);
	}
	
	@Override
	public String dummyMethod(String param) throws RemoteException {
		return "dummyText";
		
	}

	public List<String> dummyMethod2(int colsnum) throws RemoteException{
		List<String> list = new ArrayList<String>(colsnum);
		for(int i = 0; i< colsnum; i++){
			list.add("Elem_" + i);
		}
		return list;
	}

	public List<StatResultData> getStudentResult() throws RemoteException {
		StatsManager manager = new StatsManager();
		return manager.getStudentStatistic();
	}
	 public List<Course> loadAllCourses() throws RemoteException{
		StatsManager manager = new StatsManager();
		return manager.getAllCourses();
	 }
	 //Student
	 public List<StatResultData> getStudentResult(Date initialDate, Integer courseType, String dniAlumne) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getStudentStatistic(initialDate, courseType, dniAlumne);
	 }
	 //Teacher
	 public List<StatResultData> getTeacherStat1(Date date, String nameCourse,String dniProf) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getTeacherStat1(date, nameCourse, dniProf);
	 }
	 
	 public List<StatResultData> getTeacherStat2(Date date, String nameCourse,String dniProf) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getTeacherStat2(date, nameCourse, dniProf);
	 }
	 //Staff
	 public List<StatResultData> getStaffStat1(Date date, String nameCourse) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getStaffStat1(date, nameCourse);
	 }
	 public List<StatResultData> getStaffStat2(Date date, String nameCourse) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getStaffStat2(date, nameCourse);
	 }
	 public List<StatResultData> getStaffStat3(Date date, String nameCourse) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getStaffStat3(date, nameCourse);
	 }
	 public List<StatResultData> getStaffStat4(Date dateIni, Date end) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getStaffStat4(dateIni, end);
	 }
	 public List<StatResultData> getStaffStat5(String nameCourse) throws RemoteException{
		 StatsManager manager = new StatsManager();
		 return manager.getStaffStat5(nameCourse);
	 }
}
